package com.DHH.Util;

import com.DHH.BikeAction.DHHRequest;
import com.DHH.Config.ApiConstant;
import com.DHH.Config.DHHConstant;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by 汪玉东 on 2017/8/31.
 */
public class wxAccessToken {
    public  static  void main(String[] arges){
        Map<String,Object> parms=new HashMap<String, Object>();
        parms.put("appid", ApiConstant.APIID);
        parms.put("secret",ApiConstant.SECRET);
        parms.put("grant_type",ApiConstant.WX_ACCESS_TOKEN_OPTION);
        Http http=new Http();
        String rs= http.sendGet(ApiConstant.WX_ACCESS_TOKEN_URL,parms,"utf-8");
        JSONObject jsonObject= JSON.parseObject(rs);
        String access=jsonObject.get("access_token").toString();
        System.out.println(access);

 //       Map<String,Object> parms1=new HashMap<String, Object>();
//        parms1.put("appid", ApiConstant.APIID);
//        parms1.put("secret",ApiConstant.SECRET);
        JSONObject parms1=new JSONObject();
        parms1.put("access_token",access);
        parms1.put("page",ApiConstant.WX_QR_CODE_PAGE);
        parms1.put("scene","12312");
        Http http1=new Http();
        String rs1=http1.post(ApiConstant.WX_QR_CODE_URL,parms1);
        System.out.println(rs1);


    }
}
